package com.funtonow.jqdk.adapter;

import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.funtonow.jqdk.R;

import java.util.List;

/**
 * @author Jiajien
 * @date 2019/8/20
 */
public class FKDateAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private int position1;

    public FKDateAdapter(@Nullable List<String> data) {
        super(R.layout.item_fk_data_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        TextView tvDate = helper.getView(R.id.tv_date);
        helper.setText(R.id.tv_date, item);
        if (helper.getAdapterPosition() == position1) {
            tvDate.setBackgroundResource(R.drawable.tv_blue_layout1);
            tvDate.setTextColor(mContext.getResources().getColor(R.color.white));
        } else {
            tvDate.setBackgroundResource(R.drawable.tv_blue_layout);
            tvDate.setTextColor(mContext.getResources().getColor(R.color.color_222990));
        }
    }

    public void setPosition(int position) {
        this.position1 = position;
    }

}
